import request from '../utils/request.js'

const FONT_PREFIX = '/front/product'
const BACK_PREFIX = '/cloudgallery/product'

export default{
  //展示所有商品
  ShowProductList(){
        return request({
            url:`${FONT_PREFIX}/list`,
            method:'get'
        })
    },
	/**
	 * 根据商品id查询商品详情
	 * @param {Object} productID
	 */
	getInfoById(productID) {
		return request({
			url:`${FONT_PREFIX}/infoById/${productID}`,
			method: 'get'
		})
	},
	/**
	 * 复杂的聚合查询
	 */
	complexSearch(searchProductVo){
		return request({
			url: `${FONT_PREFIX}/info`,
			method: 'post',
			data: searchProductVo
		})
	},
	
	/**
	 * 搜一搜
	 */
	goSearch(obj){
		return request({
			url:`${BACK_PREFIX}/list`,
			method: 'get',
			params:obj
		})
	},
	
	/**
	 * 删库存
	 * @param {Object} obj
	 */
	toOrder(obj) {
		return request({
			url: `${FONT_PREFIX}/toOrder`,
			method: 'delete',
			params: {
				productId: obj.productId,
				count: obj.count
			}
		})
	}
}